<%@ page import="com.sun.org.apache.regexp.internal.RE" %><%--
  Created by IntelliJ IDEA.
  User: XiongMM
  Date: 2019/7/23
  Time: 下午9:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body bgcolor="yellow">

    <%!
        int add(int x,int y){
            return x+y;
        }

        int sub(int m,int n){
            return m-n;
        }

        int continueSum(int n){
            int sum = 0;
            for(int i=1;i<=n;i++){
                sum = sum + i;
            }
            return sum;
        }


    %>

    <%
        response.getWriter().write("add方法计算200和123之和:");
        int a = add(200,123);
        response.getWriter().println(a);
        response.getWriter().println("<br/> sub方法计算200和123之差：");
        int b = sub(200,123);
        response.getWriter().println(b);

        long sum;
        sum = continueSum(100);
        response.getWriter().println("<br/>");
        response.getWriter().println("1到100的连续求和:");
        //response.getWriter().print(sum);
    %>
    <%= sum%>

</body>
</html>
